package com.jt.tenant.conn;

import com.jt.tenant.app.JTApplication;
import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 2016/3/2.
 */
//@HttpCache(name = AsyType.MAX_STALE, time = 86400)
@HttpInlet(Conn.INLET_GET_CAR_GPS)
public class GetCarGps extends JTAsyGet<GetCarGps.Info> {

    public String token = JTApplication.jtPreferences.readToken();

    public GetCarGps(AsyCallBack<Info> asyCallBack) {

        super(asyCallBack);

    }

    @Override
    protected Info parserBody(Object body) {

        JSONObject o = ((JSONObject)body).optJSONObject("dto");

        Info info = new Info();

        info.status = o.optString("status");

        info.status = o.optString("status");

        info.formatted_address = o.optString("formatted_address");

        info.street = o.optString("street");

        info.street_number = o.optString("street_number");

        info.lng = o.optDouble("lng");

        info.lat = o.optDouble("lat");

        info.city = o.optString("city");

        return info;

    }

    public static class Info{

        public String status, formatted_address, street, street_number, city;

        public double lng, lat;

    }

}
